import { createApp } from "vue";
import "./style.css";
import App from "./App.vue";
import router from "./router";
import api from "./api";
import "vant/lib/index.css";

const app = createApp(App);

app.config.globalProperties.$api = api;

app.use(router);
app.mount("#app");

router.beforeEach((to, from) => {
  // 返回 false 以取消导航
  if(to.path !== '/login'){
      if(!localStorage.getItem('h5_token')){
          return '/login'
      }
  }
})